package com.ss.android.crash.log;

import android.content.Context;

import org.json.JSONObject;

public class i implements com.ss.android.crash.log.f.a {
    private static volatile i d;
    f a;
    k b;
    long c;
    private Context e;

    private i(Context arg3, com.ss.android.crash.log.j.j$a arg4) {

        this.e = arg3.getApplicationContext();
        this.c = System.currentTimeMillis();
        this.a = new f(this.e, this);
        this.b = new k(this.e, arg4);
    }

    public static void a(Context arg2, com.ss.android.crash.log.j.j$a arg3) {
        if (i.d == null) {
            Class v1 = i.class;
            synchronized (v1) {
                i.d = new i(arg2, arg3);
            }
        }
    }

    static i b() {
        if (i.d == null) {
            throw new IllegalArgumentException("CrashInfoManager not inited");
        }

        return i.d;
    }

    public final void a() {
        if (this.b != null) {
            k v0 = this.b;
            if (!v0.d) {
                com.ss.android.crash.log.j.j$a.a();
                if (com.ss.android.crash.log.j.j$a.a().containsKey("device_id")) {
                    JSONObject v1 = new JSONObject();
                    v0.a(v1, v0.a);
                    v0.b(v1, v0.a);
                    v0.c.edit().putString("header", v1.toString()).apply();
                    v0.d = true;
                }
            }
        }
    }
}

